package com.by.chapter01;


import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.v("MainActivity", "Verbose");
        Log.d("MainActivity","Debug");
        Log.i("MainActivity","Info");
        Log.w("MainActivity", "Warning");
        Log.e("MainActivity", "Error");
        Log.wtf("MainActivity","Assert");
        Button button = findViewById(R.id.regist);
        Button btn2 = findViewById(R.id.cancle);
        btn2.setOnClickListener(this);
        button.setOnClickListener(this);
        findViewById(R.id.listview).setOnClickListener(this);
        findViewById(R.id.recycleview).setOnClickListener(this);




    }

    public void click(View view) {
        Intent it = new Intent(this,ComponentActivity.class);
        startActivity(it);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.regist:
                Log.d("MainActicity","注册被点击了");
                MainActivity.this.finish();
                break;
            case R.id.cancle:
                Log.d("MainActicity","取消被点击了");
                startActivity(new Intent(MainActivity.this,RecycleActivity.class));
                break;
            case R.id.listview:
                startActivity(new Intent(MainActivity.this,ListViewActivity.class));
                break;
            case R.id.recycleview:
                startActivity(new Intent(MainActivity.this,RecycleActivity.class));
                break;

        }

    }
}
